﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace RollDesktop
{
    public class AppError
    {
        public static void Log(string message)
        {
            object obj = new object();
            string filename = "F://1.txt";
            lock (obj)
            {
                if (File.Exists(filename))
                {
                    StreamWriter sw = File.AppendText(filename);
                    sw.WriteLine("\r");
                    sw.WriteLine("记录时间：" + DateTime.Now.ToString() + "   错误信息：" + message);
                    sw.Flush();
                    sw.Close();
                }
                else
                {
                    StreamWriter sw = new StreamWriter(filename);
                    sw.WriteLine("记录时间：" + DateTime.Now.ToString() + "   错误信息：" + message);
                    sw.Flush();
                    sw.Close();
                }
            }
        }
    }
}
